﻿using MahApps.Metro.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using WpfClient.Models;

namespace WpfClient.Views
{
    /// <summary>
    /// Interaction logic for PickLineWindow.xaml
    /// </summary>
    public partial class PickLineWindow : MetroWindow
    {
        private Action<LineViewModel> _pickCallback;

        public PickLineWindow(PickLineViewModel model, Action<LineViewModel> pickCallback)
        {
            InitializeComponent();
            _pickCallback = pickCallback;
            this.DataContext = model;
        }

        private void ListBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var line = (LineViewModel)((ListBox)(sender)).SelectedItem;
            _pickCallback(line);
            this.Close();
        }
    }
}
